package com.hi3v.auth.monitor.resources;

import com.hi3v.auth.monitor.core.Person;
import com.hi3v.auth.monitor.db.PersonDAO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;

@Path("/people")
@Produces(MediaType.APPLICATION_JSON)
public class PeopleResource {

    private static final Logger LOGGER = LoggerFactory.getLogger(HelloWorldResource.class);

    private final PersonDAO peopleDAO;

    public PeopleResource(PersonDAO peopleDAO) {
        this.peopleDAO = peopleDAO;
    }

    @GET
    public void listPeople() {
        peopleDAO.createSomethingTable();
    }
    @GET
    @Path("/get/{personId}")
    public Person getPeople(@PathParam("personId") Integer personId) {
        LOGGER.info(personId.toString());
        return peopleDAO.findNameById(personId);
    }

}
